package com.qinggeng.project.api.controller;


import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.gson.JsonObject;
import com.qinggeng.common.constant.Constants;
import com.qinggeng.common.enums.CommonEnum;
import com.qinggeng.common.enums.UserConsumeEnum;
import com.qinggeng.common.enums.UserTypeEnum;
import com.qinggeng.common.exception.CustomException;
import com.qinggeng.common.utils.DateUtils;
import com.qinggeng.common.utils.SecurityUtils;
import com.qinggeng.common.utils.StringUtils;
import com.qinggeng.common.utils.text.Convert;
import com.qinggeng.framework.config.mq.MQSendUtils;
import com.qinggeng.framework.redis.RedisCache;
import com.qinggeng.framework.web.controller.BaseController;
import com.qinggeng.framework.web.domain.AjaxResult;
import com.qinggeng.project.api.dto.PositionClassifyDTO;
import com.qinggeng.project.api.security.annotation.LoginRequired;
import com.qinggeng.project.api.security.utils.ApiUtils;
import com.qinggeng.project.api.service.IApiMemberService;
import com.qinggeng.project.api.utils.AMapUtils;
import com.qinggeng.project.api.utils.OrdersCheckUtils;
import com.qinggeng.project.system.controller.SysActivityController;
import com.qinggeng.project.system.domain.*;
import com.qinggeng.project.system.mapper.DistributionPointMapper;
import com.qinggeng.project.system.mapper.UserAccountRecordOrderSingleItemMapper;
import com.qinggeng.project.system.mapper.UserMapMapper;
import com.qinggeng.project.system.service.*;
import com.qinggeng.project.tool.pay.utils.WithDrawalUtils;
import com.qinggeng.project.tool.sms.domain.json.SmsConfigJson;
import com.qinggeng.project.tool.sms.service.ISysSmsService;
import io.swagger.annotations.*;
import org.apache.commons.beanutils.ConvertUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MaxUploadSizeExceededException;

import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.Map;

import static com.qinggeng.project.api.utils.JsapiTicketUtils.getAccessToken;
import static com.qinggeng.project.api.utils.JsapiTicketUtils.getJsApiTicket;
import static com.qinggeng.project.system.controller.GoodsPercentController.ZERO;


@Api(tags="测试模块")
@RestController
@RequestMapping("${apiPath}/test")
public class ApiTestController extends BaseController {

    @Autowired
    MQSendUtils mqSendUtils;

    @Autowired
    WithDrawalUtils withDrawalUtils;

    @Autowired
    IGoodsPresaleService goodsPresaleService;

    @Autowired
    IGoodsKeywordsService keywordsService;

    @Autowired
    IGoodsService goodsService;

    @Autowired
    IOrdersPointService ordersPointService;

    @Autowired
    GoodsImgService goodsImgService;

    @Autowired
    IUserCartService userCartService;

    @Autowired
    private IOrderStatisticsService orderStatisticsService;
    @Autowired
    private IDistributionPointService pointService;

    @Autowired
    private ISysUserService sysUserService;
    @Autowired
    private IUserWalletService userWalletService;
    @Autowired
    private OrdersDistService ordersDistService;
    @Autowired
    private SinglePointSaleService singlePointSaleService;

    @Autowired
    SumPointSaleService sumPointSaleService;
    @Autowired
    private RedisCache redisCache;
    @Autowired
    private ISysSmsService smsService;
    @Autowired
    private ISysConfigService configService;
    @Autowired
    private IApiMemberService memberService;
    @Autowired
    private MQSendService mqSendService;
    @Autowired
    private IOrdersService ordersService;
    @Resource
    private UserAccountRecordOrderSingleItemMapper orderSingleItemService;
    @Autowired
    private IPositionNameService positionNameService;
    @Autowired
    private ICourierService courierService;
    @Autowired
    private ISysSmsService sysSmsService;
    @Autowired
    private IPositionClassifyService positionClassifyService;
    @Autowired
    private IGiftService giftService;
    @Autowired
    private OrdersCheckUtils ordersCheckUtils;

    @Autowired
    private IUserMapService userMapService;
    @Resource
    private DistributionPointMapper pointMapper;
    @Resource
    private UserMapMapper userMapMapper;
    @Autowired
    private ISysActivityService sysActivityService;
@Autowired
    private IGoodsGiftService goodsGiftService;
@Autowired
private IGoodsPercentService goodsPercentService;



    @ApiOperation("返回成功信息")
    @GetMapping("/ok")
    public AjaxResult ok(Long id)  {
        return AjaxResult.success();
    }

    @PostMapping(value = "/establish")
    public AjaxResult  establish(Long goodsId,Long wholeGoodsId){
        return AjaxResult.success(goodsService.establish(goodsId,wholeGoodsId));
    }

    @LoginRequired
    @ApiOperation("需要登陆的接口")
    @GetMapping("/requiredUser")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", dataType = "String", name = Constants.TOKEN, value = "token标记", required = true),
    })
    public AjaxResult requiredUser(){
        return AjaxResult.success();
    }


    @GetMapping("/test")
    public AjaxResult test() {
        return AjaxResult.success();
    }

}
